package com.cy.pj.sys.pojo.common.util;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.util.StringUtil;

import javax.servlet.http.HttpServletRequest;

public class PageUtil {
    public static <T>Page<T> startPage(){
        HttpServletRequest request = ServletUtil.getRequest();
        String pageCurrentStr = request.getParameter("pageCurrent");
        String pageSizeStr = request.getParameter("pageSize");
        int pageCurrent = StringUtil.isEmpty(pageCurrentStr)?1:Integer.parseInt(pageCurrentStr);
        int pageSize = StringUtil.isEmpty(pageSizeStr)?10:Integer.parseInt(pageSizeStr);
        return PageHelper.startPage(pageCurrent,pageSize);
    }
}